package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-12-01 00:19
 **/
public class LeetCode1446 {

    public int maxPower(String s) {
        int max = 1;
        int energy = 1;
        int len = s.length();
        for (int i = 1; i < len; i++) {
            if (s.charAt(i) == s.charAt(i - 1)) {
                energy++;
                max = Math.max(energy, max);
            } else {
                energy = 1;
            }
        }
        return max;
    }

}
